package com.local.springcloud.controller;

import com.local.springcloud.pojo.Dept;
import com.local.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lou ke
 * @version 1.0
 * @since 2020/7/29 14:07
 */
//提供Restful服务
@RestController
@RequestMapping(value = "/dept")
public class DeptController {

    @Autowired
    private DeptService deptService;

    @PostMapping(value = "/add")
    public boolean addDept(@RequestBody Dept dept) {
        return deptService.addDept(dept);
    }

    @GetMapping(value = "/selectById")
    public Dept selectById(@RequestParam(value = "deptId") Long deptId) {
        return deptService.selectById(deptId);
    }

    @GetMapping(value = "/selectAll")
    public List<Dept> selectAll() {
        return deptService.selectAll();
    }
}
